<?php


namespace App\Controller;


class CommonController
{

    /**
     * 处理输出
     * param int $code
     * param array $data
     * param string $reason
     * return \Illuminate\Http\JsonResponse
     */
    protected function out($code = 200, $data = [], $reason = 'success')
    {
        $code = (int)$code;
        if (!$reason){
            $reason= config('errorCode.'.$code.'.reason');
        }
        return compact('code', 'reason', 'data');
    }


}
